Fix doc tests for libs with deps
authorAlex Crichton <alex@alexcrichton.com>
Tue, 19 Aug 2014 20:10:55 +0000 (13:10 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 19 Aug 2014 20:13:13 +0000 (13:13 -0700)
The movement of tests to the main `target` directory forgot to update a spot
where rustdoc used a -L flag.

src/cargo/ops/cargo_test.rs
tests/test_cargo_test.rs

index 31e82700a32c856aeb9c2a92152246ea7adb8a2f..b48641e33a67a343c33b588096cb383cc4e3f001 100644 (file)
@@ -46,8 +46,8 @@ pub fn run_tests(manifest_path: &Path,
         let mut p = compile.process("rustdoc")
                            .arg("--test").arg(lib)
                            .arg("--crate-name").arg(name)
-                           .arg("-L").arg("target/test")
-                           .arg("-L").arg("target/test/deps")
+                           .arg("-L").arg(&compile.root_output)
+                           .arg("-L").arg(&compile.deps_output)
                            .cwd(package.get_root());
 
         // FIXME(rust-lang/rust#16272): this should just always be passed.
index aedacc494ac8566314bd95ecd43361a7e44b0511..38980e77fe39630d50728149599db78635593d9f 100644 (file)
@@ -226,13 +226,14 @@ test!(test_with_deep_lib_dep {
 
             [dependencies.foo]
             path = "../foo"
-
-            [lib]
-            name = "bar"
-            doctest = false
         "#)
         .file("src/lib.rs", "
             extern crate foo;
+            /// ```
+            /// bar::bar();
+            /// ```
+            pub fn bar() {}
+
             #[test]
             fn bar_test() {
                 foo::foo();
@@ -265,8 +266,16 @@ test bar_test ... ok
 
 test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
 
+{doctest} bar
+
+running 1 test
+test bar_0 ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
+
 ",
                        compiling = COMPILING, running = RUNNING,
+                       doctest = DOCTEST,
                        dir = p.url()).as_slice()));
 })